# -*- coding:utf-8 -*-
import json
import requests

def handler(event, context):
    url = "API接口地址"
    token = context.getToken()

    # Send request.
    headers = {
        'X-Auth-Token': token
    }
    files = {
        "text": "你的评价"
    }

    try:
        resp = requests.post(url, headers=headers, json=files)
        # Print result.
        print(resp.status_code)
        print(resp.text)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
        return "error"

    return "success"